const http = require('../../../utils/http.js');
const app = getApp()
const utils = require('../../../utils/util.js')
Page({
  data: {
    title: ''},
  onLoad: function (options) {
    var _this = this
    _this.setData({
      id: options.id,
      title: options.title
    })
    _this.onPageInfo(options.id)
  },
  onReady: function () {},
  onShow: function () {},
  onHide: function () {},
  onUnload: function () {},
  onPullDownRefresh: function () {},
  onReachBottom: function () {},
  onShareAppMessage: function () {},
  onPageInfo(e) {
    var _this = this
    http.getRequest('v1/order/' + e, {
        id: e
      },
      function (res) {
        console.log(res)
        res.data.pay_time = utils.formatTime(res.data.create_time, 'Y-M-D h:m:s')
        if (res.data.mall_order_queue) {
          res.data.mall_logistics.logistics_time = utils.formatTime(res.data.mall_logistics.logistics_time, 'Y-M-D h:m:s')
          res.data.mall_order_queue.expire_time = utils.formatTime(res.data.mall_order_queue.expire_time, 'Y-M-D h:m:s')
        }
        _this.setData({
          info: res.data
        })
      },
      function (err) {})
  },
  onUserCallPhone(e) {
    wx.makePhoneCall({
      phoneNumber: e.currentTarget.id,
    })
  },
  onCopy(e) {
    wx.setClipboardData({
      data: e.currentTarget.id,
      success(res) {
        wx.getClipboardData({})
      }
    })
  },
  onExeeico() {
    wx.navigateTo({
      url: '/pages/onNewPages/Logistics/logistics?id=' + this.data.id,
    })
  }
})